package behaviourNavigatore;

import jade.core.behaviours.OneShotBehaviour;
import jade.domain.AMSService;
import jade.domain.DFService;
import jade.domain.FIPAException;
import jade.domain.FIPAAgentManagement.AMSAgentDescription;
import jade.domain.FIPAAgentManagement.DFAgentDescription;
import jade.domain.FIPAAgentManagement.ServiceDescription;

public class RegistrationYellowPage extends OneShotBehaviour{

	private static final long serialVersionUID = 1L;

	@Override
	public void action() {
		
		DFAgentDescription dfd = new DFAgentDescription();
		dfd.setName(myAgent.getAID());
		ServiceDescription serviceDesc = new ServiceDescription();
		serviceDesc.setType("navigatore");
		serviceDesc.setName("JADE-navigatore");
		dfd.addServices(serviceDesc);
		
		try {
			DFService.register(myAgent, dfd);
		} catch (FIPAException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		System.out.println(myAgent.getName()+" is active!");
		
		
	}

}
